-
Notifications
You must be signed in to change notification settings - Fork 24
Onboard Intake (1/3): introduce intake runner command #952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Sample CLI usage:
|
98373d3
to
732eff1
Compare
732eff1
to
669dbb9
Compare
PS: notice that I messed up the branch by mistake, I had to cherry-pick until 7868e56 (last commit reviewed) and force push. |
return fmt.Errorf("update Intake Runner: %w", err) | ||
} | ||
|
||
p.Printer.Info("Update request for Intake Runner %q sent successfully.\n", model.RunnerId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will produce invalid JSON/YAML output in case the --output-format
flag is set.
`Update the message capacity limits for an Intake Runner with ID "xxx"`, | ||
`$ stackit intake runner update xxx --max-message-size-kib 2000 --max-messages-per-hour 10000`), | ||
examples.NewExample( | ||
`Clear the labels of an Intake Runner with ID "xxx" by providing an empty value`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`Clear the labels of an Intake Runner with ID "xxx" by providing an empty value`, | |
I guess we have to get rid of this example for now, it gives me the following error:
➜ stackit-cli git:(669dbb92) stackit intake runner update xxx --labels ""
Error: invalid argument "" for "--labels" flag: must be formatted as key=value
exit status 1
This is related to the discussion where I told you we as maintainers of this repo will take care of, sorry for that again 😅
cmd.Flags().Int64(maxMessageSizeKiBFlag, 0, "Maximum message size in KiB. Note: Overall message capacity cannot be decreased.") | ||
cmd.Flags().Int64(maxMessagesPerHourFlag, 0, "Maximum number of messages per hour. Note: Overall message capacity cannot be decreased.") | ||
cmd.Flags().String(descriptionFlag, "", "Description") | ||
cmd.Flags().StringToString(labelFlag, nil, "Labels in key=value format. To clear all labels, provide an empty string, e.g. --labels \"\"") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmd.Flags().StringToString(labelFlag, nil, "Labels in key=value format. To clear all labels, provide an empty string, e.g. --labels \"\"") | |
cmd.Flags().StringToString(labelFlag, nil, "Labels in key=value format.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit, maybe better:
cmd.Flags().StringToString(labelFlag, nil, "Labels in key=value format. To clear all labels, provide an empty string, e.g. --labels \"\"") | |
cmd.Flags().StringToString(labelFlag, nil, "Labels in key=value format, separated by commas. Example: --labels \"key1=value1,key2=value2\"") |
|
||
region := viper.GetString(config.RegionKey) | ||
cfgOptions := []sdkConfig.ConfigurationOption{ | ||
sdkConfig.WithRegion(region), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the header with the CLI version here, like described in our contribution guide:
utils.UserAgentConfigOption(cliVersion), |
) | ||
|
||
// ConfigureClient creates and configures a new Intake API client | ||
func ConfigureClient(p *print.Printer) (*intake.APIClient, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func ConfigureClient(p *print.Printer) (*intake.APIClient, error) { | |
func ConfigureClient(p *print.Printer, cliVersion string) (*intake.APIClient, error) { |
return fmt.Errorf("delete Intake Runner: %w", err) | ||
} | ||
|
||
p.Printer.Outputf("Deletion request for Intake Runner %q sent successfully.\n", model.RunnerId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, invalid JSON/YAML output in case the --output-format
flag is set to JSON/YAML.
`$ stackit intake runner update xxx --display-name "new-runner-name"`), | ||
examples.NewExample( | ||
`Update the message capacity limits for an Intake Runner with ID "xxx"`, | ||
`$ stackit intake runner update xxx --max-message-size-kib 2000 --max-messages-per-hour 10000`), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example produces an error for me:
stackit intake runner update 4db8fc33-22e0-47cd-9574-8615055750f6 --max-message-size-kib 2000 --max-messages-per-hour 10000
Error: update Intake Runner: 400 Bad Request, status code 400, Body: {"message":"invalid maximum message size - should be lower or equal to 1024"}
exit status 1
Rest looks good to me. :) |
Description
This PR onboards the new STACKIT Intake (ticket) service into the CLI.
Intake is composed of three components:
This PR contains the Intake Runners part only to make a quicker and less overwhelming review. The remaining code (2/3) can be submitted as part of this PR once the first batch has been reviewed/approved or we can open a different PR for it (as the maintainer please).
The commands are designed to work as follows:
Most customers will use
intakes
hence why we decided to go with this command structure. The folder structure will look like the following due to the hierachy desired:Checklist
make fmt
make generate-docs
(will be checked by CI)make test
(will be checked by CI)make lint
(will be checked by CI)